<!-- 设备系列 -->
<script type="text/html" template>
    <link rel="stylesheet" href="{{ layui.setter.base }}style/index.css">
    <link rel="stylesheet" href="{{ layui.setter.base }}style/autoComplete.css">
    <link rel="stylesheet" href="{{ layui.setter.base }}style/css/reset.css">
    <link rel="stylesheet" href="{{ layui.setter.base }}style/alert.css">
    <link rel="stylesheet" href="{{ layui.setter.base }}style/alert-form.css">
</script>
<style scoped>
    .row .layui-form-label{
        min-width: 80px;
        height: 30px;
        line-height: 30px;
    }
    .row .layui-input-block {
        height: auto;
    }
</style>
<div class="layui-form layui-fluid row">
        <div class="layui-form-item">
            <label class="layui-form-label">
                <span style="font-size: 18px;color: red;position: relative;display: inline-block;line-height: 20px;vertical-align: middle;top:3px;">*</span>
                设备系列编码：
            </label>
            <div class="layui-input-block">
                <input type="text" name="tcSeriesCode"  class="layui-input"  required lay-verify="required" placeholder="" autocomplete="off">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                <span style="font-size: 18px;color: red;position: relative;display: inline-block;line-height: 20px;vertical-align: middle;top:3px;">*</span>
                设备系列名称：
            </label>
            <div class="layui-input-block">
                <input type="text" name="tcSeriesName" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input" id="tcSeriesName">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                <span style="font-size: 18px;color: red;position: relative;display: inline-block;line-height: 20px;vertical-align: middle;top:3px;">*</span>
                供应商：
            </label>
            <div class="layui-input-block">
                <input type="text" name="tcSeriesPmc01" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input" id="tcSeriesPmc01">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                <span style="font-size: 18px;color: red;position: relative;display: inline-block;line-height: 20px;vertical-align: middle;top:3px;">*</span>
                设备系列说明：
            </label>
            <div class="layui-input-block">
                <textarea name="tcSeriesDsc" cols="30" rows="10" required lay-verify="required" autocomplete="off"></textarea>
            </div>
        </div>
        <div class="footer layui-form-item layui-fluid" style="margin-top: 30px;">
            <button data-lang="confirm" class="btn1 layui-btn layui-btn-radius layui-btn-primary"
                lay-filter="submit1" lay-submit>确定</button>
            <button data-lang="cancel" class="btn2 layui-btn layui-btn-radius layui-btn-primary">取消</button>
        </div>
</div>
<script type="text/html" template>
    <link rel="stylesheet" href="{{ layui.setter.base }}style/autoComplete.css">
    <link rel="stylesheet" href="{{ layui.setter.base }}style/css/patrol/project_device_alert.css">
</script>
<script type="text/html" id="addDeviceTpl">
    <style scoped>
        .leon-style-alert .screen-btn {
            display: inline-block;
            position: relative;
            height: 20px;
            line-height: 20px;
            border: 1px solid #DEDEDE;
            border-radius: 10px;
            margin: 0;
            right: 0;
            padding-left: 5px;
            background-color:transparent;
            text-indent:10px;
        }
        .leon-style-alert .search-blank-inner{
            display: inline-block;
            position: relative;
            top: -6px;
            right: -3px;
            font-size: 10px;
            background-color:#FFF;
        }
        .leon-style-alert .layui-form input{
            height: 26px;
            line-height: 26px;
            font-size: 12px;
            color: #616161;
            opacity: .7;
            border-radius: 3px;
            background-color:transparent;
        }
        .leon-style-alert .layui-table-page,.layui-table-page .layui-laypage input{
             background-color:transparent;   
        }
        .leon-style-alert .layui-table-page .layui-laypage input{
            border: 1px solid #e2e2e2;
            border-radius:2px;
        }
        .leon-style-alert .layui-table-view{
            border-width: 1px;
            border-style: solid;
            border-color: #e6e6e6;
        }
    </style>
    <div class="leon-style-alert layui-form">
        <div class="layui-alert-box">
        <div class="layui-alert-title">
            <span class="layui-title-inner">供应商选择</span>
            <span class="layui-title-screen">
            <div class="screen-btn">
                <form class="layui-form">
                <input type="search" name="pmc081" class="search-blank-inner searchInput ipt1" placeholder="搜索" autocomplete="off" />
                <button type="button" lay-submit lay-filter="queryTableDeviceHeader" class="search-blank-icon btn"></button>
                </form>
            </div>
            </span>
        </div>
        <div class="layui-content">
            <div class="con1 toggle-btn">
            <span class="screen">
                <span class="query-inner"></span>
            </span>
            </div>
            <table class="layui-table" id="table-device-alert"></table>
        </div>
        <div class="footer layui-btn-containner layui-form-item" style=" display: flex;justify-content: center;">
            <button class="btn1 layui-btn layui-btn-radius layui-btn-primary" lay-submit lay-filter="add1">添加</button>
            <button class="btn2 layui-btn layui-btn-radius layui-btn-primary" lay-submit lay-filter="cols1">取消</button>
        </div>
        </div>
    </div>
</script>
<script>
    layui.use(['table', 'admin', 'laypage', 'jquery', 'laytpl', 'tree', 'form', 'api', 'view', 'laydate', 'setter', 'treeSelect','element','utill'], function () {
        var form = layui.form;
        var table = layui.table;
        var admin = layui.admin;
        var laypage = layui.laypage;
        var $ = layui.jquery;
        var laytpl = layui.laytpl;
        var tree = layui.tree;
        var api = layui.api;
        var view = layui.view;
        var laydate = layui.laydate;
        var setter = layui.setter;
        var treeSelect = layui.treeSelect;
        var utill = layui.utill;
        var element = layui.element;
            $('.row').on('click','#tcSeriesPmc01',function(){
                layer.open({
                    type: 1,
                    title: false,
                    area: ["662px", "536px"],
                    fixed: true,
                    shadeClose: true,
                    closeBtn: 0,
                    content: $("#addDeviceTpl").html(),
                    success: alertEvent.addDevice
                });
                });
            var alertEvent = {
            addDevice: function (myopts,layero, index) {
                var myopt = {
                    done:function(res){
                        const data = res;
                    },
                }
			    $.extend(myopt,myopts)
                table.render(
                    $.extend({}, utill.tableOpts(), {
                    elem: "#table-device-alert",
                    id: "#table-device-alert",
                    height: 300,
                    width: 'auto',
                    url: api.host + api.xxcx.pmc081,
                    where: {},
                    cols: [[
                        { type: "radio",align:'left' },
                        { field: "pmc081", title: "供应商",minWidth: 490},
                        ]
                    ]
                    })
                );
                utill.keyup('.ipt1','.btn');
                form.on('submit(cols1)', function(data){
                        layer.close(layer.index);
                        return false;
                    })
                table.on('radio', function(obj){
                    var res = table.checkStatus('#table-device-alert').data;
                    form.on('submit(add1)', function(data){
                        if(res != null){
                            $('#tcSeriesPmc01').attr('value',res[0].pmc081);
                            $('#tcSeriesPmc01').data('id',res[0].pmc01);
                        }
                        layer.close(layer.index);
                        return false;
                    })
                });
                form.on("submit(queryTableDeviceHeader)", function (data) {
                    var pmc081 = data.field.pmc081;
                    table.render(
                    $.extend({}, utill.tableOpts(), {
                    elem: "#table-device-alert",
                    id: "#table-device-alert",
                    height: 300,
                    width: 'auto',
                    url: api.host + api.xxcx.pmc081,
                    where: {pmc081},
                    cols: [[
                        { type: "radio",align:'left' },
                        { field: "pmc081", title: "供应商",minWidth: 490},
                        ]
                    ]
                    })
                );
                return false;
            });
            }
        }
    });
</script>